UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DihgbtmAhKZuLprtfMKXCT14M7wOF1G88aHNB8xXd0g=' 
WHERE 
  key_id = '7ac37080aa8650e3b3e817f5de8a60a440491f19fc818b47227f3f556b5b8661' 
  AND (
    token = 'DihgbtmAhKZuLprtfMKXCT14M7wOF1G88aHNB8xXd0g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00066