UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JEsqskGhX64g7QfYvCNXkMrxhctQS5pbTjeclHfdE6c=' 
WHERE 
  key_id = '0b82c95b50eb5f50a6c835e98dcce5f968320c01d000de844ee3965431e5b7f5' 
  AND (
    token = 'JEsqskGhX64g7QfYvCNXkMrxhctQS5pbTjeclHfdE6c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039