UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dyj+Mhn4PtZknuqFlWOdI6E5TQ6UI1dUIy4by0vxuLg=' 
WHERE 
  key_id = '1d5711c2bbcae86729a4e1423a657556d9b6a717e9c36159306ae94ff79a7ebc' 
  AND (
    token = 'Dyj+Mhn4PtZknuqFlWOdI6E5TQ6UI1dUIy4by0vxuLg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036