UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ID2IowDrdqTpLzTKia3grnlZ5OPt1OAgv5/GvB0zYb4=' 
WHERE 
  key_id = '89384a9e17a306743bd0c64c32f6904154b27549041b0978324b1bd344093615' 
  AND (
    token = 'ID2IowDrdqTpLzTKia3grnlZ5OPt1OAgv5/GvB0zYb4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021