UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JuiS7uK0xF1KqtEpF68FSrCC9J0iMGACzP5yuTu0Skk='
WHERE
key_id = 'd72521a1f6c508183d0f334548b1fd7994a3ba00dc85df7c4bc93eabab199337'
AND (
token = 'JuiS7uK0xF1KqtEpF68FSrCC9J0iMGACzP5yuTu0Skk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)