UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bkC0uwsAO02CqYBmgUVDdBTlXcywKf0tD+bPIsN/9ys='
WHERE
key_id = 'b184d6fe70f474a758079150cb65c7c2ffa76900a1c43d3215a051a1e54437d6'
AND (
token = 'bkC0uwsAO02CqYBmgUVDdBTlXcywKf0tD+bPIsN/9ys='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)