UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GSNnD94fuHtKnFMrczVUABLo35cWB5hCg/o/C9ArnpY='
WHERE
key_id = 'd0df778e91fe896d1fe0aa8c9d9aba7549e15ea1642c106667577ca5abcab1fa'
AND (
token = 'GSNnD94fuHtKnFMrczVUABLo35cWB5hCg/o/C9ArnpY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)