UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z5tqINILhSScNWy8be4Z39FfHFwpw1hZH2v/RWEgVlU='
WHERE
key_id = 'aa9c55e28cdc78395ce2f4ed5f20901bb939c5d56c8db14da548e1290af67744'
AND (
token = 'Z5tqINILhSScNWy8be4Z39FfHFwpw1hZH2v/RWEgVlU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)