UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CnsZtVbe0ocHPDrIrMYfiXJkjXdmXRIxUxGcILFuPiY=' 
WHERE 
  key_id = 'b8d137a9d75b6aae95c1775115d288685695237ff24706a123ec5256ba5d0f1f' 
  AND (
    token = 'CnsZtVbe0ocHPDrIrMYfiXJkjXdmXRIxUxGcILFuPiY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019