UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd5MEKJj+cYzTfZEV52i9iu/I5kllt3A01f+0agKFVBs='
WHERE
key_id = 'e89f3b247ce0f863dd65906fed4f0913cf1e6a22d06d13ad4e80d1d3f51af70c'
AND (
token = 'd5MEKJj+cYzTfZEV52i9iu/I5kllt3A01f+0agKFVBs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)