UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tIBJDUTdzXo2vcgN0BclCTH76akQxf0inGfMdz/0XDs='
WHERE
key_id = 'a39d6269f6d63eb1016cb219dd05adfd4e2f6425bc84fed7d8323d00b7492735'
AND (
token = 'tIBJDUTdzXo2vcgN0BclCTH76akQxf0inGfMdz/0XDs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)