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