UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6rbMBHotUpUkajvrK5vh6O2P5mHVydXHom10qfZUCL4=' 
WHERE 
  key_id = 'dd101d3c49b0174f6ed8d7343c8e7ae803ac06542a2e13118fe1662e0a007cdd' 
  AND (
    token = '6rbMBHotUpUkajvrK5vh6O2P5mHVydXHom10qfZUCL4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029