UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Bt09sQtucN4Vii7Zcg/xzCXG4IXpEy+o5jNQHDAHFqY='
WHERE
key_id = 'ed682fc1dc86d939f9954dd5b608328a0e7468fc7a108b6495d8f05bb06d4602'
AND (
token = 'Bt09sQtucN4Vii7Zcg/xzCXG4IXpEy+o5jNQHDAHFqY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)