UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T6lprZitSQ0HmMrgZOFXS7m3mooCTTlOZ3s+VoqEx0s='
WHERE
key_id = '8a22bec287f7db0cc0ab8a5326be8382811717c608dff0f37573cebba39f77c1'
AND (
token = 'T6lprZitSQ0HmMrgZOFXS7m3mooCTTlOZ3s+VoqEx0s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)