UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TL91jKp9a6Y+YjGEUPIwMsEFSUPVcLAdYawrnCWL0Qs=' 
WHERE 
  key_id = '5d22df131dfea139f1fddfc2eda173e18303df9305fb3278288a0758b2d2e80f' 
  AND (
    token = 'TL91jKp9a6Y+YjGEUPIwMsEFSUPVcLAdYawrnCWL0Qs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039