UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hgbCPd1L7n0A8gV5NID5nMmmDN25iv550gutj4jaAv4='
WHERE
key_id = '3aa75517025daa667bc4d9c530e84ba54a7d7f5b90f372dd006fc734690366d6'
AND (
token = 'hgbCPd1L7n0A8gV5NID5nMmmDN25iv550gutj4jaAv4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)