UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+cMXcZ/YvLjV0vrpQaMYzwgldD6ibjkuarEn9akjdIs='
WHERE
key_id = 'ed6461d2a71994d4b4282e9df9fe17291f14e0aca150aa769646ba7569136f15'
AND (
token = '+cMXcZ/YvLjV0vrpQaMYzwgldD6ibjkuarEn9akjdIs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)