UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gKyFEYb5aT4yRJa0Jry5ZY9ZjEyU67cuAcjiZyPXBLs='
WHERE
key_id = '2a0b3fed89bba353621e7a4aed4ed713495136a65019efd4ba811ccd67707a89'
AND (
token = 'gKyFEYb5aT4yRJa0Jry5ZY9ZjEyU67cuAcjiZyPXBLs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)