UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M7WWyTKUJjcNt8PtU+tfpqs0TuWmitR+alSeN8PM+Ro=' 
WHERE 
  key_id = 'f59a105505d727a16a78cdce332f26d5597f1b72fbb1505398b4b40ff62227a4' 
  AND (
    token = 'M7WWyTKUJjcNt8PtU+tfpqs0TuWmitR+alSeN8PM+Ro=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029