UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bslr3wjPZS+STz5DNO47TMX1BgbtWqnF1Nt3fFe84Qc=' 
WHERE 
  key_id = 'f766cf1beb79c8fe77f80e0c013675616767b4d5d9335076f3732be74ad30129' 
  AND (
    token = 'bslr3wjPZS+STz5DNO47TMX1BgbtWqnF1Nt3fFe84Qc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016