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

Query time 0.00034