UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S2whY4cy+qO5AGNWqlTWThFFXQLWJBwfUWUM7WnA79o=' 
WHERE 
  key_id = '5bbd97498c2ebc1320a74bcf94d3486a96c72ca575303b3a7fbd6065f6c5ba5b' 
  AND (
    token = 'S2whY4cy+qO5AGNWqlTWThFFXQLWJBwfUWUM7WnA79o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038