UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EkaH0BMryJrY8nrbdnjrlS6EPF50HDlDtTMcGy7xx+g='
WHERE
key_id = 'af84e449446dc7f2cfb1fce1bfa7773b4c04ca44f565ada35ddbeebe55dea3c3'
AND (
token = 'EkaH0BMryJrY8nrbdnjrlS6EPF50HDlDtTMcGy7xx+g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)